import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * Created by webrx on 2017/6/8.
 */@WebServlet("/text01")
public class Text01 extends HttpServlet{
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setCharacterEncoding("utf-8");
        PrintWriter out = resp.getWriter();
        Map<String,Object> map = new HashMap<String, Object>();
        map.put("one","你哈");
        map.put("two","大家好");
        Set<String> key = map.keySet();
       /* for(String ss: key){
            System.out.println(ss);
            System.out.println(map.get(ss));
        }*/
        Iterator<String> it = key.iterator();
        while (it.hasNext()){
            String ss =it.next();
            /*System.out.println(ss);*/
            System.out.println(map.get(ss));
        }
    }
}
